﻿using System;

namespace Affinity.Flux
{
    /// <summary>
    /// Applied to a property or method to mark it as an inlet.
    /// </summary>
    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = true, Inherited = true)]
    public class InletAttribute : Attribute
    {
        /// <summary>
        /// Constructor accepting the contract value and any InletFlags specified for this inlet.
        /// </summary>
        /// <param name="contract"></param>
        /// <param name="flags"></param>
        public InletAttribute(object contract, InletFlags flags = InletFlags.None)
        {
            _Contract = contract;
            _Flags = flags;
        }

        /// <summary>
        /// Gets the contract value for this inlet.
        /// </summary>
        public object Contract
        {
            get { return _Contract; }
        }

        /// <summary>
        /// Gets the InletFlags for this inlet.
        /// </summary>
        public InletFlags Flags
        {
            get { return _Flags; }
        }

        private readonly object _Contract;
        private readonly InletFlags _Flags = InletFlags.None;
    }
}
